<!DOCTYPE html>
<html class="x-admin-sm">
    <head>
        <meta charset="UTF-8">
        <title>欢迎页面-X-admin2.2</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
        <link rel="stylesheet" href="./css/font.css">
        <link rel="stylesheet" href="./css/xadmin.css">
		<link rel="stylesheet" href="js/Cesium/Widgets/widgets.css" />
        <script src="./lib/layui/layui.js" charset="utf-8"></script>
        <script type="text/javascript" src="./js/xadmin.js"></script>
		<script src="js/Cesium/Cesium.js"></script>
        <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
        <!--[if lt IE 9]>
          <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
          <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
        <![endif]-->
		<style>
			html,body{
				margin: 0;
				padding: 0;
				height: 100%;
				width: 100%;
			}
			#contanter{
				width:100%;
				height:100%
			}    
			/* 去除logo信息 */	
			.cesium-widget-credits{ 
				display:none!important; 
				visibility:hide!important; 
			} 
		</style>
    </head>
    <body>
		<div id="contanter"></div>
		<script>
			var viewer = new Cesium.Viewer("contanter",{
					animation: false,  //是否显示动画控件
		            baseLayerPicker: false, //是否显示图层选择控件
		            geocoder: true, //是否显示地名查找控件
		            timeline: false, //是否显示时间线控件
		            sceneModePicker: true, //是否显示投影方式控件
		            navigationHelpButton: false, //是否显示帮助信息控件
		            infoBox: true,  //是否显示点击要素之后显示的信息
					// 加载地形数据
					// terrainProvider: new Cesium.CesiumTerrainProvider({
					// 	url: Cesium.IonResource.fromAssetId(3956)
					// })
				})
		

		  var waterFace=[
				113.0, 34.0, 0,
				113.7, 34.0, 0,
				113.7, 34.5, 0,
				113.0, 34.5, 0];
	// 	  var waterPrimitive = new Cesium.Primitive({
	// 		show:true,// 默认隐藏
	// 		allowPicking:false,
	// 		geometryInstances : new Cesium.GeometryInstance({
	// 		  geometry : new Cesium.PolygonGeometry({
	// 			polygonHierarchy : new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArrayHeights(waterFace)),
	// 			//extrudedHeight: 0,//注释掉此属性可以只显示水面
	// 			//perPositionHeight : true//注释掉此属性水面就贴地了
	// 		  })
	// 		}),
	// 		// 可以设置内置的水面shader
	// 		appearance : new Cesium.EllipsoidSurfaceAppearance({
	// 		  material : new Cesium.Material({
	// 			fabric : {
	// 			  type : 'Water',
	// 			  uniforms : {
	// 				//baseWaterColor:new Cesium.Color(0.0, 0.0, 1.0, 0.5),
	// 				//blendColor: new Cesium.Color(0.0, 0.0, 1.0, 0.5),
	// 				//specularMap: 'gray.jpg',
	// 				//normalMap: '../assets/waterNormals.jpg',
	// 				normalMap: './images/2.jpg',
	// 				frequency: 1000.0,
	// 				animationSpeed: 0.01,
	// 				amplitude: 10.0
	// 			  }
	// 			}
	// 		  }),
	// 		  fragmentShaderSource:'varying vec3 v_positionMC;\nvarying vec3 v_positionEC;\nvarying vec2 v_st;\nvoid main()\n{\nczm_materialInput materialInput;\nvec3 normalEC = normalize(czm_normal3D * czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)));\n#ifdef FACE_FORWARD\nnormalEC = faceforward(normalEC, vec3(0.0, 0.0, 1.0), -normalEC);\n#endif\nmaterialInput.s = v_st.s;\nmaterialInput.st = v_st;\nmaterialInput.str = vec3(v_st, 0.0);\nmaterialInput.normalEC = normalEC;\nmaterialInput.tangentToEyeMatrix = czm_eastNorthUpToEyeCoordinates(v_positionMC, materialInput.normalEC);\nvec3 positionToEyeEC = -v_positionEC;\nmaterialInput.positionToEyeEC = positionToEyeEC;\nczm_material material = czm_getMaterial(materialInput);\n#ifdef FLAT\ngl_FragColor = vec4(material.diffuse + material.emission, material.alpha);\n#else\ngl_FragColor = czm_phong(normalize(positionToEyeEC), material);\
	// gl_FragColor.a=0.5;\n#endif\n}\n'//重写shader，修改水面的透明度
	// 		})
	// 	  });
	// 	  viewer.scene.primitives.add(waterPrimitive);
	
		
		  
		  function applydjk_WaterMaterial(primitive, scene) {
		      primitive.appearance.material = new Cesium.Material({
		          fabric : {
		              type : 'Water',
		              uniforms : {
		                  normalMap:'./images/2.jpg',
		                  frequency: 10000.0,
		                  animationSpeed: 0.01,
		                  amplitude: 50
		              }
		          }
		      });
		  }
		   
		    var djk_Polygon = viewer.scene.primitives.add(new Cesium.Primitive({
		          geometryInstances : new Cesium.GeometryInstance({
		              geometry : new Cesium.PolygonGeometry({
		                polygonHierarchy : new Cesium.PolygonHierarchy(Cesium.Cartesian3.fromDegreesArray(waterFace)),
						extrudedHeight:0,
						height:0,
		                vertexFormat : Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT
		              })
		          }),
		          appearance : new Cesium.EllipsoidSurfaceAppearance({
		              aboveGround : true
		          }),
		          show : true
		      }));
		  	applydjk_WaterMaterial(djk_Polygon, viewer.scene);
			
			viewer.camera.flyTo({
						destination : Cesium.Cartesian3.fromDegrees( 113.0, 34.0, 6000000.0),
						orientation : {
						  heading: Cesium.Math.toRadians(0.0), //默认朝北0度，顺时针方向，东是90度
						  pitch: Cesium.Math.toRadians(-90), //默认朝下看-90,0为水平看，
						  roll: Cesium.Math.toRadians(0) //默认0
						}
			});
			
		</script>
    </body>
</html>